package no.monsen.client.init;

import no.monsen.client.common.MonsenConnectionConfigurer;
import no.monsen.client.controller.MonsenController;
import no.monsen.client.controller.MonsenMessageList;
import no.monsen.client.ui.MonsenSystrayUI;
import no.monsen.monsenservice.MonsenFact;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.scheduling.quartz.CronTriggerBean;

public class GOMonsen {

	@Autowired
	private MonsenConnectionConfigurer monsenProxyConfigurer;
	private MonsenMessageList monsenMessageList;
	
	public GOMonsen() {
		ApplicationContext ctx = new ClassPathXmlApplicationContext("classpath:springApplicationContext.xml");
		CronTriggerBean jobDetail = (CronTriggerBean) ctx.getBean("cronTrigger");
		monsenMessageList = (MonsenMessageList) ctx.getBean("monsenMessageList");

		MonsenController controller = new MonsenController();
		MonsenSystrayUI ui = new MonsenSystrayUI(monsenMessageList, controller);
		MonsenFact mf = new MonsenFact();
		mf.setFact("Lars Monsen 'fakta' vil vises: " + jobDetail.getNextFireTime());
		monsenMessageList.postMessage(mf, "Info");

	}

	public void setMonsenMessageList(MonsenMessageList monsenMessageList) {
		this.monsenMessageList = monsenMessageList;
	}

	public static void main(String[] args) {
		new GOMonsen();
	}
}
